"""
Chrome() ---> find_element_by_xxx ---> WebElement
         ---> find_elements_by_xxx ---> list[WebElement]
"""
from selenium import webdriver

options = webdriver.ChromeOptions()
# 添加一个参数设置使用无头浏览器（没有浏览器界面）
options.add_argument('--headless')
driver = webdriver.Chrome(options=options)
driver.get('https://image.so.com/')
print(driver.get_cookies())
kw_input = driver.find_element_by_css_selector('#search_kw')
# kw_input = driver.find_element_by_id('search_kw')
kw_input.send_keys('苍老师')
search_button = driver.find_element_by_xpath('/html/body/header/div/section[1]/form/button')
search_button.click()
imgs = driver.find_elements_by_css_selector('img[src]')
for img in imgs:
    print(img.get_attribute('src'))
driver.set_window_size(1200, 960)
driver.get_screenshot_as_file('image360.png')
driver.close()
